<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
<form action="">
<p>name</p>
<p><input type="text" name='username'></p>
<p>code</p>
<p><input type="text" name='password'></p>
<p><input type="submit" value='ok'></p>

</form>
</body>
<script type="text/javascript">
	
usernameobj=document.getElementsByName('username');
usernameobj[0].onfocus=function(){
	this.style.outlineColor='red';
}


</script>
</html>